package com.wangyf.thread.other;

import org.openjdk.jol.info.ClassLayout;

import java.util.concurrent.TimeUnit;

/**
 * Created by feng on 2020/12/23.
 * 查看Java对象内存布局测试
 * 4秒以内 new出来的都是
 */
public class T01_HelloJOL {
    public static void main(String[] args) throws InterruptedException {
        TimeUnit.SECONDS.sleep(5);
        Object obj = new Object();
        System.out.println(ClassLayout.parseInstance(obj).toPrintable(obj));
        System.out.println("==========================================================================");
        //TimeUnit.SECONDS.sleep(5);
        synchronized (obj) {
            System.out.println(ClassLayout.parseInstance(obj).toPrintable(obj));
            System.out.println("==========================================================================");
        }
        System.out.println(ClassLayout.parseInstance(obj).toPrintable(obj));
    }
}
